package com.molichuxing.services.property.sdk;

/**
 * 支付回调日志类型
 * 
 * @author zoumingyu
 *
 */
public enum WechatpayNotifyTypeEnum {
	/**
	 * 支付回调
	 */
	PAY(1, "支付回调"),
	/**
	 * 退款回调
	 */
	REFUND(2, "退款回调");

	private int value;

	private String name;

	WechatpayNotifyTypeEnum(int value, String name) {
		this.value = value;
		this.name = name;
	}

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	/**
	 * 通过value获取枚举的name
	 *
	 * @param value
	 * @return
	 */
	public static String getName(int value) {
		for (WechatpayNotifyTypeEnum enumerate : WechatpayNotifyTypeEnum.values()) {
			if (enumerate.getValue() == value) {
				return enumerate.name();
			}
		}
		return null;
	}

	/**
	 * 通过枚举名获取枚举类
	 *
	 * @param enumerate
	 * @return
	 */
	public static WechatpayNotifyTypeEnum getEnum(String enumerate) {
		try {
			return Enum.valueOf(WechatpayNotifyTypeEnum.class, enumerate);
		} catch (Exception e) {

		}
		return null;
	}
}
